<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"><title>个人人情往来</title>
<head th:replace="common/incHead :: incHead"></head>
<body class="ok-body-scroll console">
<div class="ok-body home">
    <div class="layui-row ">
        <div class="layui-col-md3">
            <div class="layui-card" layoutH="22">
                <div class="layui-card-header">
                    <div class="ok-card-title">分组信息</div>
                </div>
                <div class="ok-card-body">
                    <ul class="folder-list" style="padding: 0">
                        <li th:if="${!#lists.isEmpty(groupList)}" class="p-xxs" th:each="item:${groupList}">
                            <a href="javascript:" th:if="${favorGroup.id} == ${item.id}"><i class="layui-icon layui-icon-link"></i>
                                <selection class="text-info">[[${item.groupSort}]]:[[${item.groupName}]]</selection>
                            </a>
                            <a th:href="@{/biz/favor/contacts(groupId=${item.id})}" th:if="${favorGroup.id} != ${item.id}"><i class="layui-icon layui-icon-link"></i>
                                <selection class="">[[${item.groupSort}]]:[[${item.groupName}]]</selection>
                            </a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="layui-col-md9 p-l-sm">
            <div class="layui-card">
                <div class="ok-card-body">
                    <form class="layui-form layui-form-pane" lay-filter="pagerForm" id="pagerForm" action="/biz/favor/contacts" method="get">
                        <input type="hidden" id="groupId" name="groupId" th:value="${groupId}"/>
                        <input type="hidden" id="pageNum" name="pageNum" value="1"/>
                        <input type="hidden" name="numPerPage" th:value="${page?.numPerPage}"/>
                        <input type="hidden" name="orderField" th:value="${orderField}"/>
                        <input type="hidden" name="orderDirection" th:value="${orderDirection}"/>
                        <div class="layui-row pa-condition">
                            <div class="layui-row">
                                <div th:replace="common/plugin :: pa-input-cond('favorDay','日期','layui-col-md3',${favorDay})"></div>
                                <div th:replace="common/plugin :: pa-input-cond('favorName','姓名','layui-col-md3',${favorName})"></div>
                                <div th:replace="common/plugin :: pa-input-cond('favorTags','标签','layui-col-md3',${favorTags})"></div>
                                <button class="layui-btn layui-btn-sm layui-btn-primary pull-right m-l-xs" title="重置数据" type="reset"><i class="layui-icon layui-icon-return"></i>重置</button>
                                <button class="layui-btn layui-btn-sm layui-btn-normal pull-right btnPagerForm" title="重新检索"><i class="layui-icon layui-icon-search"></i>重新检索</button>
                            </div>
                        </div>
                    </form>
                    <div class="layui-row ljLayTableBox">
                        <table class="layui-hide" id="indexTable" lay-filter="indexTable"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div th:replace="common/incBottom :: incBottom"></div>
<!-- 初始化表格数据 -->
<script th:inline="javascript">
    /*<![CDATA[*/
    let indexData = [];
    let initSort = {
        field: [[${orderField}]] || 'id',
        type: [[${orderDirection}]] || 'desc'
    };
    /*[# th:each="item,itemStat:${records}"]*/
    indexData.push({
        id: [[${item.id}]],
        groupId: [[${item.groupId}]],
        favorDay: [[${item.favorDay}]],
        favorName: [[${item.favorName}]],
        favorRelation: [[${item.favorRelation}]],
        favorDesc: [[${item.favorDesc}]],
        favorTags: [[${item.favorTags}]],
        income: [[${item.income}]],
        expenditure: [[${item.expenditure}]],
        returnDay: [[${item.returnDay}]],
        returnAmount: [[${item.returnAmount}]],
        returnDesc: [[${item.returnDesc}]],
        dataStatus: [[${item.dataStatus}]],
        createTime: [[${@lj.date(item.createTime)}]]
    });
    /*[/]*/
    /*]]>*/
</script>
<script th:inline="none">
    layui.use(["jquery", "table", "okLayer", "okPapper", "okUtils"], function () {
        let table = layui.table;
        let okPapper = layui.okPapper;
        let $ = layui.jquery;
        let okUtils = layui.okUtils;
        let config = okUtils.local("okConfig") || okConfig || {};
        table.render({
            elem: '#indexTable',
            id: 'indexTable',
            height: 'full-88',
            page: false,
            limit: indexData.length,
            data: indexData,
            initSort: initSort,
            toolbar: true,
            toolbar: "#toolbarTpl",
            totalRow: true,
            size: config.tableSize,
            cols: [[
                {type: "checkbox", fixed: "left", totalRowText: '合计:'},
                {field: "id", title: "自增ID", fixed: "left", width: 90, sort: true},
                {field: "favorDay", title: "日期", width: 120},
                {field: "favorName", title: "姓名", width: 120},
                {field: "favorRelation", title: "关系", width: 120},
                {field: "income", title: "收入", width: 100, totalRow: true},
                {field: "expenditure", title: "支出", width: 100, totalRow: true},
                {field: "favorTags", title: "标签", minWidth: 150},
                {field: "favorDesc", title: "备注", minWidth: 150},
            ]],
            done: function (res, curr, count) {
            }
        });
        table.on('sort(indexTable)', function (obj) {
            $("input[name='orderField']").val(obj.field);
            $("input[name='orderDirection']").val(obj.type);
            $("#pagerForm").submit();
        });
        okPapper.init();
        okLoading.close($);
    })
</script>
<div th:replace="common/plugin :: pa-input-datatime('ts,te')"></div>
<!-- 头工具栏模板 -->
<script type="text/html" id="toolbarTpl">
    <div class="layui-btn-container">
        <button th:if="${@lj.limit('BizFavorContactsAdd')>0}" class="layui-btn layui-btn-sm layui-btn-warm" title="个人人情往来新增" refTable="indexTable" th:ljUrl="|/biz/favor/contacts/add?groupId=${groupId}|" target="ljOpenSubmit" ljWidth="800px" ljHeight="600px">
            <i class="layui-icon layui-icon-add-circle"></i>添加
        </button>
        <button th:if="${@lj.limit('BizFavorContactsEdit')>0}" class="layui-btn layui-btn-sm" title="个人人情往来编辑:{tid}" ljUrl="/biz/favor/contacts/edit?id={tid}" ljWidth="800px" refTable="indexTable" target="ljOpenSubmit"><i class="layui-icon layui-icon-edit"></i>编辑</button>
        <button th:if="${@lj.limit('BizFavorContactsDetail')>0}" class="layui-btn layui-btn-sm layui-btn-normal" title="个人人情往来详情:{tid}" ljUrl="/biz/favor/contacts/detail?id={tid}" refTable="indexTable" ljWidth="800px" target="ljOpenCon"><i class="layui-icon layui-icon-form"></i>详情</button>
        <button th:if="${@lj.limit('BizFavorContactsDel')>0}" class="layui-btn layui-btn-sm layui-btn-danger" title="确认要删除该个人人情往来吗?" ljUrl="/biz/favor/contacts/del?id={tid}" refTable="indexTable" target="ljAjaxTodo"><i class="layui-icon layui-icon-delete"></i>删除</button>
    </div>
</script>
<!-- DataStatus枚举模板 -->
<div th:replace="common/enum :: pa_enum_DataStatus"></div>
</body>
</html>